package avicit.bdp.dgs.standard.vo;

import avicit.bdp.common.base.BaseDTO;
import avicit.bdp.core.enums.DataStateEnum;
import avicit.bdp.core.enums.DataElementDataTypeEnum;
import avicit.bdp.core.enums.DataElementStandardTypeEnum;
import avicit.platform6.core.annotation.log.LogField;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.handler.inter.IExcelModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Objects;
import javax.persistence.Transient;
import org.apache.commons.lang3.StringUtils;

/**
 * 数据标准-数据元导入结果
 *
 * @author mayi
 */
@ApiModel(value = "DataElementImportResult", description = "数据元导入结果")
public class DataElementImportResult extends BaseDTO implements IExcelModel {

  private static final long serialVersionUID = 1L;

  /** 中文名称 */
  @Excel(name = "*中文名称", orderNum = "1", width = 15)
  @ApiModelProperty(value = "中文名称", name = "name")
  private String name;

  /** 英文名称 */
  @Excel(name = "*英文名称", orderNum = "2", width = 15)
  @ApiModelProperty(value = "英文名称", name = "enName")
  private String enName;

  /** 标准编码 */
  @Excel(name = "*标准编码", orderNum = "3", width = 15)
  @ApiModelProperty(value = "标准编码", name = "code")
  private String code;

  @Excel(name = "*分类全路径", orderNum = "4", width = 30)
  @ApiModelProperty(value = "分类全路径", name = "fullTypeName")
  @Transient
  private String fullTypeName;

  /**
   * 数据类型
   *
   * @see DataElementDataTypeEnum
   */
  @Excel(
      name = "数据类型",
      orderNum = "5",
      replace = {
        "_null",
        "STRING_0",
        "DOUBLE_1",
        "BIGINT_2",
        "TIMESTAMP_3",
        "DATE_4",
        "BOOLEAN_5",
        "DECIMAL_6"
      })
  @ApiModelProperty(value = "数据类型", name = "dataType")
  private Integer dataType;

  /**
   * 标准类型
   *
   * @see DataElementStandardTypeEnum
   */
  @Excel(
      name = "标准类型",
      orderNum = "6",
      replace = {"_null", "国际标准_0", "国家标准_1", "地方标准_2", "行业标准_3", "企业标准_4"})
  @ApiModelProperty(value = "标准类型", name = "standardType")
  private Integer standardType;

  /** 标准来源 */
  @Excel(name = "标准来源", orderNum = "7")
  @ApiModelProperty(value = "标准来源", name = "standardFrom")
  private String standardFrom;

  /** 业务含义 */
  @Excel(name = "业务含义", orderNum = "8", width = 30)
  @ApiModelProperty(value = "业务含义", name = "businessMeaning")
  private String businessMeaning;

  /** 长度 */
  @Excel(name = "长度", orderNum = "9")
  @ApiModelProperty(value = "长度")
  private Integer length;

  /** 精度 */
  @Excel(name = "精度", orderNum = "10")
  @ApiModelProperty(value = "精度")
  private Integer decimalPrecision;

  /** 值域标准代码 */
  @Excel(name = "值域标准代码", orderNum = "11", width = 20)
  @LogField
  @ApiModelProperty(value = "值域标准代码", name = "lookupTableCode")
  @Transient
  private String lookupTableCode;

  /** 是否非空 */
  @Excel(
      name = "是否非空",
      orderNum = "12",
      width = 20,
      replace = {"_null", "否_0", "是_1"})
  @ApiModelProperty(value = "是否非空")
  private Integer notNull;

  /** 是否唯一 */
  @Excel(
      name = "是否唯一",
      orderNum = "13",
      width = 20,
      replace = {"_null", "否_0", "是_1"})
  @ApiModelProperty(value = "是否唯一")
  private Integer uniqueKey;

  /**
   * 状态
   *
   * @see DataStateEnum
   */
  @Excel(
      name = "状态",
      orderNum = "14",
      replace = {"_null", "编辑中_0", "审批中_1", "已驳回_2", "已发布_3", "已废止_9"})
  @ApiModelProperty(value = "状态", name = "status")
  private Integer status;

  /** 数据元版本 */
  @Excel(name = "版本", orderNum = "15", width = 15)
  @ApiModelProperty(value = "版本", name = "dataElementVersion")
  private String dataElementVersion;

  // 校验过程中的错误信息
  @Excel(name = "错误信息", orderNum = "16")
  @ApiModelProperty(value = "错误信息", name = "errorMsg")
  private String errorMsg;

  public String getFullTypeName() {
    return fullTypeName;
  }

  public void setFullTypeName(String fullTypeName) {
    this.fullTypeName = fullTypeName;
  }

  public String getCode() {
    return code;
  }

  public void setCode(String code) {
    this.code = code;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getEnName() {
    return enName;
  }

  public void setEnName(String enName) {
    this.enName = enName;
  }

  public Integer getStatus() {
    return status;
  }

  public void setStatus(Integer status) {
    this.status = status;
  }

  public Integer getDataType() {
    return dataType;
  }

  public void setDataType(Integer dataType) {
    this.dataType = dataType;
  }

  public Integer getStandardType() {
    return standardType;
  }

  public void setStandardType(Integer standardType) {
    this.standardType = standardType;
  }

  public String getStandardFrom() {
    return standardFrom;
  }

  public void setStandardFrom(String standardFrom) {
    this.standardFrom = standardFrom;
  }

  public String getBusinessMeaning() {
    return businessMeaning;
  }

  public void setBusinessMeaning(String businessMeaning) {
    this.businessMeaning = businessMeaning;
  }

  public Integer getLength() {
    return length;
  }

  public void setLength(Integer length) {
    this.length = length;
  }

  public Integer getDecimalPrecision() {
    return decimalPrecision;
  }

  public void setDecimalPrecision(Integer decimalPrecision) {
    this.decimalPrecision = decimalPrecision;
  }

  public String getLookupTableCode() {
    return lookupTableCode;
  }

  public void setLookupTableCode(String lookupTableCode) {
    this.lookupTableCode = lookupTableCode;
  }

  public Integer getNotNull() {
    return notNull;
  }

  public void setNotNull(Integer notNull) {
    this.notNull = notNull;
  }

  public Integer getUniqueKey() {
    return uniqueKey;
  }

  public void setUniqueKey(Integer uniquekey) {
    this.uniqueKey = uniquekey;
  }

  public String getDataElementVersion() {
    return dataElementVersion;
  }

  public void setDataElementVersion(String dataElementVersion) {
    this.dataElementVersion = dataElementVersion;
  }

  @Override
  public String getLogFormName() {
    if (StringUtils.isEmpty(super.logFormName)) {
      return "数据标准模块";
    } else {
      return super.logFormName;
    }
  }

  @Override
  public String getErrorMsg() {
    return errorMsg;
  }

  @Override
  public void setErrorMsg(String s) {
    if (Objects.isNull(this.errorMsg)) {
      this.errorMsg = s;
    } else {
      this.errorMsg = this.errorMsg + s;
    }
  }
}
